<% extend 'phone/base.html' %>

<% block 'head' : %>
<link rel="stylesheet" href="/dist/phone-order-list.css">
<% end %>

<div ng-controller="AppCtrl" ng-cloak>

    <div class="am-tabs" data-am-tabs>
        <ul class="am-tabs-nav am-nav am-nav-tabs">
            <li class="am-active">
                <a ng-click="status=0">
                    待付款
                    <% if @nums[0] != 0: %>
                        <span class="am-badge am-badge-sm am-badge-danger am-round"><%= @nums[0] %></span>
                    <% end %>
                </a>
            </li>
            <li>
                <a ng-click="status=1">
                    待发货
                    <% if @nums[1] != 0: %>
                        <span class="am-badge am-badge-sm am-badge-danger am-round"><%= @nums[1] %></span>
                    <% end %>
                </a>
            </li>
            <li>
                <a ng-click="status=2">
                    待收货
                    <% if @nums[2] != 0: %>
                        <span class="am-badge am-badge-sm am-badge-danger am-round"><%= @nums[2] %></span>
                    <% end %>
                </a>
            </li>
            <li>
                <a ng-click="status=3">
                    已收货
                    <% if @nums[3] != 0: %>
                        <span class="am-badge am-badge-sm am-badge-danger am-round"><%= @nums[3] %></span>
                    <% end %>
                </a>
            </li>
        </ul>

        <div class="am-tabs-bd">
            <div ng-view=""></div>
        </div>
    </div>

    <div class="am-padding-sm" >
        <div class="am-panel am-panel-default shoppingcart am-margin-bottom-sm" ng-repeat="order in list" ng-controller="OrderCtrl">
            <div class="am-panel-hd shoppingcart-shop-title am-cf">
                订单号: {{order.id}}
                <span>状态:{{order.status | statusStr}}</span>
                <span class="am-icon am-icon-angle-double-down am-fr" ng-show="order.showAll" ng-click="order.showAll = !order.showAll"></span>
                <span class="am-icon am-icon-angle-double-up am-fr" ng-hide="order.showAll" ng-click="order.showAll = !order.showAll"></span>
            </div>
            <div class="am-panel-bd" ng-show="order.showAll">
                <div ng-repeat="orderItem in order.OrderItems">
                    <div class="shoppingcart-item" >
                        <div class="shoppingcart-item-main">
                            <img ng-src="{{orderItem.goods.mainImg}}" >
                            <h3>{{orderItem.goods.title}}</h3>
                            <p class="am-text-sm am-cf">
                                <span class="am-text-danger">￥ {{orderItem.goods.price}} </span>
                                <span class="am-fr am-margin-right-sm">x {{orderItem.num}}</span>
                            </p>
                        </div>
                    </div>

                </div>
                <div class="am-padding-sm am-text-sm">
                    <p>
                        <span>共{{order.num}}件</span>
                        <span>运费:{{order.fare}}元</span>
                        <span>共:{{order.price}}元</span>
                    </p>
                    <p>下单时间: {{order.createdAt | date : 'yyyy/MM/dd hh:mm'}}</p>
                    <p class="am-paading-horizontal-sm">留言: {{order.message}}</p>
                    <!--<p class="am-paading-horizontal-sm" ng-show="">评价</p>-->
                </div>

            </div>
            <div class="am-panel-footer am-text-right">
                <div class="am-btn-group-sm">
                    <a ng-href="/user/wechat-pay/{{order.id}}" class="am-btn am-btn-danger" ng-show="order.status == 0" >付款</a>
                    <div class="am-btn am-btn-success" ng-show="order.status == 2" ng-click="check(order.id)">确认收货</div>
                    <a href="/user/evaluation?id={{order.id}}" class="am-btn am-btn-danger" ng-show="order.status == 3">评价</a>
                </div>
            </div>
        </div>
    </div>

    <div class="am-text-center am-padding" ng-show="loading != 2" ng-click="loadMore()">
        <i class="am-icon {{loading == 0 ? 'am-icon-hand-o-down' : 'am-icon-spinner'}}"></i>
        {{loading == 0 ? '加载更多' : '正在加载'}}
    </div>
</div>


<% block 'scripts': %>
<script src="/dist/phone-order-list.js"></script>
<% end %>